package com.my.zidingyikongjian.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.my.zidingyikongjian.R;

public class IndexActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_index);

        initView();
    }

    private void initView() {
        findViewById(R.id.btn_index_one).setOnClickListener(this);
        findViewById(R.id.btn_index_two).setOnClickListener(this);
        findViewById(R.id.btn_index_range).setOnClickListener(this);
        findViewById(R.id.btn_index_canvas).setOnClickListener(this);
        findViewById(R.id.btn_index_drawText).setOnClickListener(this);
        findViewById(R.id.btn_index_berzier).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_index_one: // 跳转第一课
                goIntent(SplishActivity.class);
                break;
            case R.id.btn_index_two: // 跳转第二课
                goIntent(RouteAndTextActivity.class);
                break;
            case R.id.btn_index_range: // 跳转第三课
                goIntent(RegionActivity.class);
                break;
            case R.id.btn_index_canvas: // 第四课
                goIntent(FourCanvasActivity.class);
                break;
            case R.id.btn_index_drawText: // 第五课
                goIntent(DrawTextActivity.class);
                break;
            case R.id.btn_index_berzier: // 第六课
                goIntent(SixActivity.class);
                break;
        }
    }

    private void goIntent(Class cla) {
        Intent intent = new Intent(IndexActivity.this, cla);
        startActivity(intent);
    }
}
